/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAL;

import DTO.DTOExportDetail;

/**
 *
 * @author Pham
 */
public class DALExportDetail {
    ConnectionDB conn;
    
    public DALExportDetail() 
    {
        conn = new ConnectionDB();
    }
    
    //method create export detail
    public boolean createExportDetail(DTOExportDetail dtoExpDetail)
    {
        try{
            String queryInsert = String.format("insert into `export_detail`(export_id, product_id, quantity) values('%s', %d, %d)", 
                              dtoExpDetail.getDtoExport().getExportId(), dtoExpDetail.getDtoPro().getProductID(), dtoExpDetail.getQuantity());
            if(conn.exeUpdate(queryInsert))
                return true;
            return false;
        }
        catch(Exception ex)
        {
            System.err.printf(ex.getMessage());
            return false;
        }
    }
    
    
    
}
